package org.jeecg.modules.third.kaiyunshukedaikai;

import org.apache.commons.beanutils.PropertyUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.*;


public class KaiyunUtils {
    private static final Logger LOGGER = LoggerFactory.getLogger(KaiyunUtils.class);

    public static <T> Map<String, Object> convertEntityToMap(T entity) throws IllegalAccessException {
        Map<String, Object> map = new HashMap<>();
        // 使用PropertyUtils.copyProperties将对象的属性值拷贝到Map中
        try {
            map = PropertyUtils.describe(entity);
            // 移除class属性
            map.remove("class");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return map;
    }

}
